import { apiUrl } from '~/config';
import Request from '~/core/request';

export function favoriteCooks (cookId,page,size) {
	return Request.get(`${apiUrl}/cooks/${cookId}/favorite-cooks?page=${page}&size=${size}`);
}


// 获取厨师信息
export function getCooks (cookId) {
	return Request.get(`${apiUrl}/cooks/${cookId}`);
}

// 获取厨师社交数据-阅读量、收藏数、点赞数
export function cookActionCounts (cookId) {
	return Request.get(`${apiUrl}/cooks/${cookId}/cook-action?myCookId=1`);
}

export function getMyWorks (Id, page, size) {
	return Request.get(`${apiUrl}/cooks/${Id}/showcases?page=${page}&size=${size}`);
}

export function getMyResume (Id, page, size) {
	return Request.get(`${apiUrl}/cooks/${Id}/job-histories?sort=startDate,desc&page=${page}&size=${size}`);
}

// 创建收藏
export function favoriteActions (data) {
	return Request.post(`${apiUrl}/favorite-actions`, data);
}

// 删除收藏
export function delFavorited (favoriteid) {
	return Request.delete(`${apiUrl}/favorite-actions/${favoriteid}`);
}

// 创建点赞
export function likeActions (data) {
	return Request.post(`${apiUrl}/like-actions`, data);
}

// 删除点赞
export function delLikeActions (likeid) {
	return Request.delete(`${apiUrl}/like-actions/${likeid}`);
}


// 删除收藏
export function delCard (cookId, unFavoriteCookId) {
	return Request.post(`${apiUrl}/cooks/${cookId}/unfavorite/${unFavoriteCookId}`);
}
